package net.huashitong.oversee.web;

import com.sirdc.modules.core.web.JsonBaseController;
import net.huashitong.Project.filter.NewProjectsFilter;
import net.huashitong.Project.service.NewProjectsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 分析报告接口
 */
@Controller
@RequestMapping("/record/projectRecord")
public class ProjectRecordCtrl extends JsonBaseController {

    @Autowired
    private NewProjectsService newProjectsService;

    @Override
    protected String getView(String s) {
        return null;
    }

    /**
     * 开工时间表
     */
    @ResponseBody
    @RequestMapping(value = "/queryStartSchedule", method = RequestMethod.GET)
    public Map<String, Object> queryPlanStartSchedule() {
        Map<String, Object> result = newProjectsService.queryStartSchedule();
        return result;
    }

    /**
     * 根据时间查询实际开工时间跟计划开工时间的项目
     * 如项目未完成则列出剩余节点数
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/queryStartScheduleByDataTime", method = RequestMethod.POST)
    public Map<String, Object> queryStartScheduleByDataTime(@RequestBody NewProjectsFilter filter) {
        List<Map<String, Object>> list = newProjectsService.queryStartScheduleByDataTime(filter);
        Map<String,Object> result = new HashMap<>();
        result.put("code","200");
        result.put("message","获取成功:根据时间查询实际开工时间跟计划开工时间的项目");
        result.put("data",list);
        return result;
    }

}
